package com.saguitech.sgemeos.ui.adapters;

import android.content.Context;
import android.database.MatrixCursor;

import com.saguitech.sgemeos.R;
import com.saguitech.sgemeos.business.ExpositionBusiness;
import com.saguitech.sgemeos.business.ExpositorBusiness;

public class ExpositionCursor extends MatrixCursor {

	public static String[] columnNames = { "_id", "title", "desc", /*"type",*/
			"vacancy", "location",  "times", /*"date", "initialTime", "finalTime",*/ 
			"nameExpositor" };

	public ExpositionCursor() {
		super(columnNames);
		
	}

	public void addExposition(ExpositionBusiness expo,
			ExpositorBusiness expositor, Context context) {
		RowBuilder row = super.newRow();
		row.add(expo.getId());
		row.add(expo.getTitle());
		row.add(expo.getDescription());
		//row.add(expo.getType());
		row.add(expo.getVacancies());
		row.add(expo.getLocation().getAddress());
		
		row.add(expo.getTimesFormatted().replace("@", context.getText(R.string.till)));
//		SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
//		row.add(formatter.format(expo.getTimeList().get(expo.getIndexTimeToShow()).getInitialTime()));
//		formatter = new SimpleDateFormat("HH:mm");
//		row.add(formatter.format(expo.getTimeList().get(expo.getIndexTimeToShow()).getInitialTime()));
//		row.add(formatter.format(expo.getTimeList().get(expo.getIndexTimeToShow()).getFinalTime()));
		
		row.add(expositor.getName());
	}

}
